package a01_Array;

/**
 * @Author quan
 * @Description 数组的逆序[12345]——>[54321]
 * @Date 2023/2/8 11:35
 */
public class ReverseArr {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,667,8};
        int[] res = reverse(arr);
        for (int i = 0; i < res.length; i++) {
            System.out.println(res[i]);
        }
    }
    public static int[] reverse(int[] arr){
        for (int i = 0; i <= (arr.length)-1; i++) {
            for (int j = arr.length-1; j > 0; j--) {
                int temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
        return arr;
    }
}
